﻿using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;

namespace YourLastOptionsDialog.Core.Attributes
{
    /// <summary>
    /// An option attribute that represents a <see cref="TimeSpan"/> option.
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public sealed class OptionTimeSpanAttribute : OptionAttribute
    {
        private string _maximum = TimeSpan.MaxValue.ToString("c", CultureInfo.InvariantCulture);

        private string _step = TimeSpan.FromSeconds(1.0).ToString("c", CultureInfo.InvariantCulture);

        /// <summary>
        /// Gets or sets the maximum value allowed. Has to be provided as "hh:mm:ss" or other
        /// compatible <see cref="TimeSpan"/> string formats.
        /// </summary>
        [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "This is a legitimate date format.")]
        public string Maximum
        {
            get
            {
                return _maximum;
            }

            set
            {
                _maximum = value;
            }
        }

        /// <summary>
        /// Gets or sets the step used in the UI for the selector. Has to be provided as "hh:mm:ss" or other
        /// compatible <see cref="TimeSpan"/> string formats.
        /// </summary>
        [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "This is a legitimate date format.")]
        public string Step
        {
            get
            {
                return _step;
            }

            set
            {
                _step = value;
            }
        }
    }
}